package server;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;

public class LoginPasswordGenerator {
    public static void main(String[] args) throws FileNotFoundException {
        RandomAccessFile file = new RandomAccessFile("auth_file.log", "rw");
        Object monitor = new Object();
        for (int i = 0; i < 1000; i++) {
            new Thread(() -> {
                synchronized (monitor){
                    String string = new String(Thread.currentThread().getName() + ";" + Thread.currentThread().getName() + "\r\n");
                    try {
                        file.write(string.getBytes());
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }).start();
        }
    }
}
